<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        
    </style>
</head>
<body>
    <div class="app">
        计算属性：{{ sum1 }} - {{ sum1 }} <br>
        方法：{{ sum2() }} - {{ sum2() }}
    </div>
</body>
<script src="../vue.global.js"></script>
<script>
    Vue.createApp({
        data(){
            return {
                arr:[3,4,5,6,7]
            }
        },
        computed:{
            sum1(){
                console.log("计算属性")
                return this.arr.reduce((val,prev)=>val+prev, 0);
            }
        },
        methods:{
            sum2(){
                console.log("方法")
                return this.arr.reduce((val,prev)=>val+prev, 0);
            }
        }
    }).mount(".app")




</script>
</html>